/**
 * @Author YuanYuan
 * @Date 2022/5/16
 * @Time 9:27
 */
class Animal{
    public String name;
    public int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void eat() {
        System.out.println(name+" 正在吃（animal）");
    }
}
class Cat extends Animal{
    public Cat(String name, int age) {
        super(name, age);
    }

    @Override
    public void eat() {
        System.out.println(name+"吃猫条");
    }

    public void liquid() {
        System.out.println("猫"+name+"是液体");
    }
}
//class Pig extends Animal{
//
//    public Pig(String name, int age) {
//        super(name, age);
//    }
//
//    @Override
//    public void eat() {
//        System.out.println(name+"吃西瓜皮");
//    }
//
//    public void eated() {
//        System.out.println("猪"+name+"会被宰了吃肉");
//    }
//}
public class TestDemo {

    public static void main(String[] args) {
        Animal cat = new Cat("猫猫",1);
        cat.eat();
    }

    public static void main2(String[] args) {

        Animal animal = new Cat("猫猫",1);

//        if(animal instanceof Pig){
//            Pig cat = (Pig) animal;
//            cat.eated();
//        }


    }
    public static void main1(String[] args) {
        //Animal cat = new Cat();
        //Animal pig = new Pig();
        //cat.liquid();
        //pig.eated();
    }
}
